<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        
    </div>

    <script src="./node_modules/vue/dist/vue.js"></script>
    <!-- 1引入vuex的依赖 -->
    <script src="./node_modules/vuex/dist/vuex.js"></script>
    <script src="./node_modules/axios/dist/axios.js"></script>

    <script>
        //当数据太多时就要把数据分到多个模块里，好管理数据
        let moduleA={
            state:{
                num:123
            },
            mutations:{},//同步方法
            actions:{},//异步方法
            getter:{},//计算属性
        }
        let moduleB = {
            state:{
                num:456
            },
            mutations:{},
            actions:{},
            getter:{},

        }
        

        let store =new Vuex.Store({
            modules:{
                a:moduleA,
                b:moduleB,
            }
               
            
        })
  console.log(store.state.a.num);
  console.log(store.state.b.num);

        let vm =new Vue({
           store,
            el:"#app",
        })
    </script>
    
</body>
</html>